﻿@model WaiGaoQiaoWeb.Models.OneCanteenSummaryReportVM
@{
    ViewBag.Title = "OneCanteenSummaryReportIndex";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@section Head
{
    @Html.Css("dp")
    @Html.Js("datepicker")
    <script type="text/javascript">
        var mainheight = document.documentElement.clientHeight;
        var mainWidth = document.documentElement.clientWidth;
        $(document).ready(function () {
            $("#StartTime").datepicker({ picker: "<img class='picker' align='middle' src='../../Images/icons/s.gif' alt=''/>" });
            $("#EndTime").datepicker({ picker: "<img class='picker' align='middle' src='../../Images/icons/s.gif' alt=''/>" });
            var otherpm = $("#title").height() + $("#findDiv").height(); // 290;
            var gh = mainheight - otherpm - 60;
            var option = {
                height: gh,
                width: mainWidth,
                url: '@Url.Action("GetList")',
                colModel: [
                    { display: 'SN', name: 'SN', width: 60, sortable: false, align: 'left', hide: true, iskey: true },
                    { display: '日期', width: 80, sortable: false, hide: false, align: 'left' },
                    { display: '次数', width: 60, sortable: false, hide: false, align: 'left' },
			        { display: '金额', width: 60, sortable: false, hide: false, align: 'left' },
                    { display: '早餐次数', width: 60, sortable: false, hide: false, align: 'left' },
                    { display: '早餐金额', width: 60, sortable: false, hide: false, align: 'left' },
                    { display: '午餐次数', width: 60, sortable: false, hide: false, align: 'left' },
                    { display: '午餐金额', width: 60, sortable: false, hide: false, align: 'left' },
                    { display: '晚餐次数', width: 60, sortable: false, hide: false, align: 'left' },
                    { display: '晚餐金额', width: 60, sortable: false, hide: false, align: 'left' },
                    { display: '夜宵次数', width: 60, sortable: false, hide: false, align: 'left' },
                    { display: '夜宵金额', width: 60, sortable: false, hide: false, align: 'left' }
				],
                singleselected: true,
                sortname: "Sequence",
                sortorder: "asc",
                title: false,
                usepager: true,
                page: 1,
                rp: 20,
                rpOptions: [10, 15, 20],
                showcheckbox: true,
                rowbinddata: true,
                query: $("#StartTime").val() + "&" + $("#EndTime").val() + "&"
                             + $("#DEP_ID :selected").val() + "&" + $("#EMPNO").val() + "&" + $("#PNAME").val() + "&" + $("#MacNo").val() + "&" + SelectClick1()
            };
            $("#FundsOperatingList").flexigrid(option);

            function SelectClick1() {
                var vall = "";
                if ($("#chLKXF")[0].checked.toString() == "true") {
                    vall += "1";
                    vall += ",";
                }
                if ($("#chWM")[0].checked.toString() == "true") {
                    vall += "101";
                    vall += ",";
                }
                if ($("#chZDJ")[0].checked.toString() == "true") {
                    vall += "102";
                    vall += ",";
                }
                if ($("#chWL")[0].checked.toString() == "true") {
                    vall += "103";
                    vall += ",";
                }
                if ($("#chQD")[0].checked.toString() == "true") {
                    vall += "104";
                    vall += ",";
                }
                if ($("#chJBF")[0].checked.toString() == "true") {
                    vall += "105";
                    vall += ",";
                }
                if ($("#chSG")[0].checked.toString() == "true") {
                    vall += "106";
                    vall += ",";
                }
                if ($("#chBF")[0].checked.toString() == "true") {
                    vall += "107";
                    vall += ",";
                }
                if ($("#chDX")[0].checked.toString() == "true") {
                    vall += "108";
                    vall += ",";
                }
                return vall;
            }

            $("#btnQueryList").click(function () {
                option.query = $("#StartTime").val() + "&" + $("#EndTime").val() + "&"
                             + $("#DEP_ID :selected").val() + "&" + $("#EMPNO").val() + "&" + $("#PNAME").val() + "&" + $("#MacNo").val() + "&" + SelectClick1();
                option.newp = 0;
                $("#FundsOperatingList").flexOptions(option).flexReload();
            });
            $("#chALL").click(function () {
                selectGroup('td1', 'chALL');
            });
            $("#btnExport").click(function () {
                var vstarttime = $("#StartTime").val();
                var vendtime = $("#EndTime").val();
                var vdepid = $("#DEP_ID :selected").val();
                var vempno = $("#EMPNO").val();
                var vpname = $("#PNAME").val();
                var vmacno = $("#MacNo").val();
                var strulr = "ReportOut?StartTime=" + vstarttime + "&EndTime=" + vendtime + "&DEP_ID=" + vdepid + "&EMPNO=" + vempno + "&PNAME=" + vpname + "&MacNo=" + vmacno + "&ALL=" + SelectClick1();
                var subwin = window.open(strulr, "", "menubar=no,toolbar=no,status=no,resizable=no,scrollbars=yes");
                subwin.moveTo(0, 0);
                subwin.resizeTo(window.screen.availWidth, window.screen.availHeight);
                return false;
            });
        });
        function selectGroup(div_id, grp_id) {
            var g_div = document.getElementById(div_id);
            var grp = document.getElementById(grp_id);
            var eles = g_div.getElementsByTagName("input");
            for (var i = 0; i < eles.length; i++) {
                if (eles[i].disabled == false) eles[i].checked = grp.checked;
            }
        }

    </script>
}
<div id="container">
    <div id="mainContent">
        <div id="title" class="title">
            一食堂汇总表</div>
        <div id="findDiv">
            <table>
                <tr>
                    <td style="text-align: right; width: 80px;">
                        开始日期：
                    </td>
                    <td>
                        @Html.TextBox("StartTime", DateTime.Now.Date.ToString("yyyy-MM-dd"), new { @ReadOnly = true, @style = "width:140px;" })
                    </td>
                    <td style="text-align: right; width: 80px;">
                        结束日期：
                    </td>
                    <td>
                        @Html.TextBox("EndTime", DateTime.Now.Date.ToString("yyyy-MM-dd"), new { @ReadOnly = true, @style = "width:140px;" })
                    </td>
                    <td style="text-align: right; width: 80px;">
                        部门名称:
                    </td>
                    <td>
                        @Html.DropDownListFor(model => model.DEP_ID,
                                   ViewData["Deptment"] as IEnumerable<SelectListItem>,
                                   new { @style = "width:150px; height:22px; font-size:13px;" })
                    </td>
                </tr>
                <tr>
                    <td style="text-align: right; width: 80px;">
                        人员编号：
                    </td>
                    <td>@Html.TextBoxFor(model => model.EMPNO, new { @style = "width:140px;" })
                    </td>
                    <td style="text-align: right; width: 80px;">
                        姓名：
                    </td>
                    <td>
                        @Html.TextBoxFor(model => model.PNAME, new { @style = "width:140px;" })
                    </td>
                    <td style="text-align: right; width: 80px;">
                        机号：
                    </td>
                    <td>
                        @Html.TextBoxFor(model => model.MacNo, new { @style = "width:140px;" })
                    </td>
                </tr>
                <tr>
                    <td colspan="5" style="text-align: left" id="td1">
                        &nbsp;全部:@Html.CheckBoxFor(model => model.chALL)&nbsp;&nbsp;&nbsp; 拉卡消费:@Html.CheckBoxFor(model => model.chLKXF)&nbsp;
                        外卖:@Html.CheckBoxFor(model => model.chWM)&nbsp; 招待券:@Html.CheckBoxFor(model => model.chZDJ)&nbsp;
                        外理:@Html.CheckBoxFor(model => model.chWL)&nbsp; 清单:@Html.CheckBoxFor(model => model.chQD)&nbsp;
                        加白饭:@Html.CheckBoxFor(model => model.chJBF)&nbsp; 水果:@Html.CheckBoxFor(model => model.chSG)&nbsp;
                        包房:@Html.CheckBoxFor(model => model.chBF)&nbsp; 点心:@Html.CheckBoxFor(model => model.chDX)&nbsp;
                    </td>
                    <td>
                        <a id="btnQueryList" class="button" href="javascript:void(0);"><span>查 询</span></a>
                        <a id="btnExport" class="button" href="javascript:void(0);"><span>导 出</span></a>
                    </td>
                </tr>
            </table>
        </div>
        <table id="FundsOperatingList" style="display: none;">
        </table>
    </div>
</div>
